package com.javaEE.tes.dao;


import com.javaEE.tes.dao.dto.StudentClass1;
import com.javaEE.tes.dao.dto.TeacherCurriculum;
import com.javaEE.tes.entities.Curriculum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

public interface CurriculumRepository extends CrudRepository<Curriculum,Long> {
    @Autowired
    List<Curriculum> findAll();
    @Query(nativeQuery = true,
            value ="SELECT c.curriculum_num as curriculumNum, c.curriculum_name as curriculumName,c.class_hour,c.credit,c.evaluate,c.nature,t.name1 " +
            "FROM curriculum AS c LEFT JOIN teacher AS t ON c.teacher_id = t.teacher_id "+
            "GROUP BY c.curriculum_num, c.curriculum_name, c.class_hour, c.credit, c.evaluate, c.nature, t.name1 ORDER BY c.curriculum_name;"
    )
    List<TeacherCurriculum> teacherCurriculum();

}
